package com.qingcheng.consumer;

import com.alibaba.fastjson.JSON;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;

import java.util.Map;


public class SmsMessageConsumer implements MessageListener {

    public void onMessage(Message message) {
        String stringJson = new String(message.getBody());
        //string字符串 转换成map
        Map<String,String> map =(Map) JSON.parseObject(stringJson);
        //获取值
        String phone = map.get("phone");
        String code = map.get("code");
        System.out.println("手机号："+phone+"验证码："+code);
    }
}
